//
//  YCLifeViewController.m
//  YCSchool
//
//  Created by yanglinxia on 16/4/27.
//  Copyright © 2016年 yanglinxia. All rights reserved.
//  学车生活

#import "YCLifeViewController.h"
#import "YCFoodServiceViewController.h"
#import "YCCarServiceViewController.h"
#import "YCHouseServiceViewController.h"
#import "YCLifeServiceViewController.h"


// 接口只返回图标与标题
// YCAPIService

@implementation YCLifeViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    [self makeView];
    
}

- (void)makeView
{
    UITapGestureRecognizer *tapFood = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapFood:)];
    // 餐饮image
    UIImageView *foodImageView = [[UIImageView alloc] init];
    foodImageView.contentMode = UIViewContentModeCenter;
    foodImageView.image = [UIImage imageNamed:@"餐饮服务"];
    [self.view addSubview:foodImageView];
    foodImageView.userInteractionEnabled = YES;
    [foodImageView addGestureRecognizer:tapFood];
    UILabel *foodLabel = [[UILabel alloc] init];
    foodLabel.text = @"餐饮服务";
    foodLabel.textColor = [UIColor yc_colorWithUInt:0x333333];
    foodLabel.font = [UIFont systemFontOfSize:15];
    [self.view addSubview:foodLabel];
    foodLabel.userInteractionEnabled = YES;
    [foodLabel addGestureRecognizer:tapFood];
    
    
    UITapGestureRecognizer *tapHouse = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapHouse:)];
    // 住宿image
    UIImageView *houseImageView = [[UIImageView alloc] init];
    houseImageView.contentMode = UIViewContentModeCenter;
    houseImageView.image = [UIImage imageNamed:@"住宿服务"];
    [self.view addSubview:houseImageView];
    houseImageView.userInteractionEnabled = YES;
    [houseImageView addGestureRecognizer:tapHouse];
    UILabel *houseLabel = [[UILabel alloc] init];
    houseLabel.text = @"住宿服务";
    houseLabel.textColor = [UIColor yc_colorWithUInt:0x333333];
    houseLabel.font = [UIFont systemFontOfSize:15];
    [self.view addSubview:houseLabel];
    houseLabel.userInteractionEnabled = YES;
    [houseLabel addGestureRecognizer:tapHouse];
    
    
    UITapGestureRecognizer *tapCar = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapCar:)];
    // 班车image
    UIImageView *carImageView = [[UIImageView alloc] init];
    carImageView.contentMode = UIViewContentModeCenter;
    carImageView.image = [UIImage imageNamed:@"班车服务"];
    [self.view addSubview:carImageView];
    carImageView.userInteractionEnabled = YES;
    [carImageView addGestureRecognizer:tapCar];
    UILabel *carLabel = [[UILabel alloc] init];
    carLabel.text = @"班车服务";
    carLabel.textColor = [UIColor yc_colorWithUInt:0x333333];
    carLabel.font = [UIFont systemFontOfSize:15];
    [self.view addSubview:carLabel];
    carLabel.userInteractionEnabled = YES;
    [carLabel addGestureRecognizer:tapCar];
    
    
    UITapGestureRecognizer *tapLife = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapLife:)];
    // 生活image
    UIImageView *lifeImageView = [[UIImageView alloc] init];
    lifeImageView.contentMode = UIViewContentModeCenter;
    lifeImageView.image = [UIImage imageNamed:@"生活服务"];
    [self.view addSubview:lifeImageView];
    lifeImageView.userInteractionEnabled = YES;
    [lifeImageView addGestureRecognizer:tapLife];
    UILabel *lifeLabel = [[UILabel alloc] init];
    lifeLabel.text = @"生活服务";
    lifeLabel.textColor = [UIColor yc_colorWithUInt:0x333333];
    lifeLabel.font = [UIFont systemFontOfSize:15];
    [self.view addSubview:lifeLabel];
    lifeLabel.userInteractionEnabled = YES;
    [lifeLabel addGestureRecognizer:tapLife];
    
    // 餐饮
    [foodImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(heightFromIphone6Height(76));
        make.left.equalTo(self.view).offset(22);
        make.width.height.equalTo(@38);
    }];
    [foodLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(foodImageView);
        make.left.equalTo(foodImageView.mas_right).offset(16);
    }];
    
    // 住宿
    [houseImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(foodImageView.mas_bottom).offset(heightFromIphone6Height(40));
        make.left.equalTo(self.view).offset(22);
        make.width.height.equalTo(@38);
    }];
    [houseLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(houseImageView);
        make.left.equalTo(houseImageView.mas_right).offset(16);
    }];
    
    // 班车
    [carImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(houseImageView.mas_bottom).offset(heightFromIphone6Height(40));
        make.left.equalTo(self.view).offset(22);
        make.width.height.equalTo(@38);
    }];
    [carLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(carImageView);
        make.left.equalTo(carImageView.mas_right).offset(16);
    }];
    
    // 生活
    [lifeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(carImageView.mas_bottom).offset(heightFromIphone6Height(40));
        make.left.equalTo(self.view).offset(22);
        make.width.height.equalTo(@38);
    }];
    [lifeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(lifeImageView);
        make.left.equalTo(lifeImageView.mas_right).offset(16);
    }];

}


#pragma mark - 监听手势
- (void)tapFood:(UITapGestureRecognizer *)foodGes
{
    YCLogFunc
    YCFoodServiceViewController *foodServiceVc = [[YCFoodServiceViewController alloc] init];
    [self.navigationController pushViewController:foodServiceVc animated:YES];
}

- (void)tapHouse:(UITapGestureRecognizer *)houseGes
{
    YCLogFunc
    YCHouseServiceViewController *houseServiceVc = [[YCHouseServiceViewController alloc] init];
    [self.navigationController pushViewController:houseServiceVc animated:YES];
}

- (void)tapCar:(UITapGestureRecognizer *)carGes
{
    YCLogFunc
    YCCarServiceViewController *carServiceVc = [[YCCarServiceViewController alloc] init];
    [self.navigationController pushViewController:carServiceVc animated:YES];
}

- (void)tapLife:(UITapGestureRecognizer *)lifeGes
{
    YCLogFunc
    YCLifeServiceViewController *lifeServiceVc = [[YCLifeServiceViewController alloc] init];
    [self.navigationController pushViewController:lifeServiceVc animated:YES];
}

@end
